---
title: GraphQL vs REST
description: 'Sofa API: A GraphQL library to create fully RESTful and configurable API gateway. Get benefits of GraphQL and REST, support existing clients and generate documentation. Try now! #GraphQL #Sofa'
---

# Getting Started

An open source library you install on your GraphQL server to create a fully RESTful and configurable API gateway.

- **Don’t choose between REST and GraphQL**
- Get most of the **benefits of GraphQL** on the backend and frontend, while using and **exposing REST**
- **Support all your existing clients** with REST while improving your backend stack with GraphQL
- Create custom, perfectly client-aligned REST endpoints for your frontend simply by naming a route and attaching a query
- In the other way around (REST to GraphQL) you won’t get the best of both worlds. Instead just less powerful, harder-to-maintain server implementations with a some of the benefits of GraphQL. It can be a good and fast start for a migration though.
- Fully **generated documentation** that is always up-to-date
- **GraphQL Subscriptions as Webhooks**

## Installation

Install Sofa:

```sh npm2yarn
npm i sofa-api
```

## Usage

```js
import { useSofa } from 'sofa-api';
import express from 'express';

const app = express();

app.use('/api', useSofa({ schema }));

// GET  /api/messages
// POST /api/add-message
```
